package study02;

public class Java10_string_sub {
    public static void main(String[] args) {
//        都是截取
        String a = " wocao ni ma ";
        System.out.println(a.substring(0, "wocao".length()));
        System.out.println(a.substring(6));

        String[] s1 = a.split(" ");
        System.out.println(s1);

        System.out.println(a.trim());

//        替换
        System.out.println(a.replace("o", "O"));
        System.out.println(a.replaceAll("o|n", "O"));

//        大小写转换
        System.out.println(a.toLowerCase());
        System.out.println(a.toUpperCase());

//        字符串的查找
        System.out.println("===========");
        System.out.println(a.toCharArray());
        System.out.println(a.getBytes());
        System.out.println(a.charAt(1));
        System.out.println(a.indexOf("o"));
        System.out.println(a.lastIndexOf("o"));

//        是否包含
        System.out.println(a.contains("w"));
//        是否以指定字符串开头
        System.out.println(a.startsWith(" "));
//        是否为空
        System.out.println(a.isEmpty());
    }
}
